#pragma once
#include "Orange/Window.h"

#include "glad/glad.h"
#include "Orange/Log.h"
#include "Event/ApplicationEvent.h"
#include "Event/KeyEvent.h"
#include "Event/MouseEvent.h"
#include "Renderer/GraphicContext.h"

struct GLFWwindow;

namespace Orange
{
    class WindowsWindow : public Window
    {
    public:
        WindowsWindow(const WindowProps &props);
        ~WindowsWindow();

        const unsigned int GetWidth() const override;
        const unsigned int GetHeight() const override;
        // 设置垂直同步
        void SetSync(bool enable) override;
        const bool IsSync() const override;

        // 窗口刷新事件
        void OnUpdate() override;

        // 获取当前窗口
         void *GetNativeWindow() const override;

        // 设置回调函数

        void SetCallback(const EventCallback &callback) override
        {
            m_Data.Callback = callback;
        };

    private:
        void Init(const WindowProps &props);
        void ShutDown() override;

    private:
        GLFWwindow *m_Window;

        struct WindowData
        {
            bool Vsync;

            unsigned int m_Width;
            unsigned int m_Height;
            std::string m_Title;

            EventCallback Callback;
        };

        GraphicContext *m_Context;
        WindowData m_Data;
    };
}